import java.awt.*;
import java.awt.event.*;

import javax.swing.*;

public class Log_In extends JPanel implements ActionListener {
	protected JLabel userLabel;
	protected JLabel pwLabel;
	protected JTextField userTF;
	protected JPasswordField pwPF;
	protected JButton logIn;
	private String username = new String();
	private char[] pw;
	
	public Log_In() {
		super(new GridBagLayout());
		
		userLabel = new JLabel("Username:  ", SwingConstants.LEFT);
		
        //userTF is where the user enters their username
        userTF = new JTextField(30);
        
        pwLabel = new JLabel("Password:  ", SwingConstants.LEFT);
        		
        //pwPF is where the user enters their password
        pwPF = new JPasswordField(30);
        
        logIn = new JButton("Log In");
        logIn.addActionListener(this);
        
		
		GridBagConstraints c = new GridBagConstraints();
        c.gridwidth = GridBagConstraints.REMAINDER;

        c.fill = GridBagConstraints.HORIZONTAL;
        
        add(userLabel, c);
        add(userTF, c);
        add(pwLabel, c);
        add(pwPF, c);
        add(logIn, c);
        c.fill = GridBagConstraints.BOTH;
        c.weightx = 1.0;
        c.weighty = 1.0;
//        add(scrollPane, c);
		
	}
	
	public void actionPerformed(ActionEvent evt) {
    	username = userTF.getText();
    	pw = pwPF.getPassword();
    	String pwS = new String(pw);
    	System.out.println("Username: " + username);
    	System.out.println("Password: " + pwS);
    	this.setVisible(false);
    }
}